home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / comm / term / term34Source.lha / SoundPanel.c < prev    next >
C/C++ Source or Header  |  1993-07-16  |  15KB  |  547 lines

  1. /*
  2. **    SoundPanel.c
  3. **
  4. **    Editing panel for sound configuration
  5. **
  6. **    Copyright © 1990-1993 by Olaf `Olsen' Barthel & MXM
  7. **        All Rights Reserved
  8. */
  9.  
  10. #include "termGlobal.h"
  11.  
  12. enum    {    GAD_BELL,        GAD_SELECT_BELL,
  13.         GAD_CONNECT,        GAD_SELECT_CONNECT,
  14.         GAD_DISCONNECT,        GAD_SELECT_DISCONNECT,
  15.         GAD_GOOD_TRANSFER,    GAD_SELECT_GOOD_TRANSFER,
  16.         GAD_BAD_TRANSFER,    GAD_SELECT_BAD_TRANSFER,
  17.         GAD_RING,        GAD_SELECT_RING,
  18.         GAD_VOICE,        GAD_SELECT_VOICE,
  19.         GAD_PRELOAD,
  20.         GAD_USE,GAD_LOAD,GAD_SAVE,GAD_CANCEL };
  21.  
  22. STATIC struct Gadget *
  23. CreateAllGadgets(struct SoundConfig *Config,struct Gadget *GadgetArray[],struct Gadget **GadgetList)
  24. {
  25.     struct Gadget        *Gadget;
  26.     struct NewGadget     NewGadget;
  27.     UWORD             Counter = 0;
  28.  
  29.     SZ_SizeSetup(Window -> WScreen,&UserFont,TRUE);
  30.  
  31.     memset(&NewGadget,0,sizeof(struct NewGadget));
  32.  
  33.     if(Gadget = CreateContext(GadgetList))
  34.     {
  35.         SZ_AddLeftOffset(SZ_LeftOffsetDelta(MSG_SOUNDPANEL_BELL_GAD,MSG_SOUNDPANEL_VOICE_GAD));
  36.  
  37.         SZ_ResetMaxWidth();
  38.  
  39.         SZ_UpdateMaxWidth(STRING_KIND,NULL,30,NULL);
  40.  
  41.         SZ_SetWidth(SZ_ResetMaxWidth());
  42.  
  43.         NewGadget . ng_GadgetText    = LocaleString(MSG_SOUNDPANEL_BELL_GAD);
  44.         NewGadget . ng_GadgetID        = Counter;
  45.  
  46.         GadgetArray[Counter++] = Gadget = CreateGadget(STRING_KIND,Gadget,&NewGadget,
  47.             SZ_Adjust,    TRUE,
  48.             SZ_AutoWidth,    TRUE,
  49.             SZ_LeaveFolder,    TRUE,
  50.  
  51.             GTST_MaxChars,    255,
  52.             GTST_String,    Config -> BellFile,
  53.         TAG_DONE);
  54.  
  55.         NewGadget . ng_GadgetID        = Counter;
  56.  
  57.         GadgetArray[Counter++] = Gadget = CreateGadget(FILE_KIND,Gadget,&NewGadget,
  58.             SZ_Adjust,    TRUE,
  59.             SZ_AutoWidth,    TRUE,
  60.             SZ_PlaceLeft,    TRUE,
  61.         TAG_DONE);
  62.  
  63.         NewGadget . ng_GadgetText    = LocaleString(MSG_SOUNDPANEL_CONNECT_GAD);
  64.         NewGadget . ng_GadgetID        = Counter;
  65.  
  66.         GadgetArray[Counter++] = Gadget = CreateGadget(STRING_KIND,Gadget,&NewGadget,
  67.             SZ_Adjust,    TRUE,
  68.             SZ_AutoWidth,    TRUE,
  69.             SZ_AlignExtra,    TRUE,
  70.             SZ_AlignBottom,    TRUE,
  71.             SZ_LeaveFolder,    TRUE,
  72.  
  73.             GTST_MaxChars,    255,
  74.             GTST_String,    Config -> ConnectFile,
  75.         TAG_DONE);
  76.  
  77.         NewGadget . ng_GadgetID        = Counter;
  78.  
  79.         GadgetArray[Counter++] = Gadget = CreateGadget(FILE_KIND,Gadget,&NewGadget,
  80.             SZ_Adjust,    TRUE,
  81.             SZ_AutoWidth,    TRUE,
  82.             SZ_PlaceLeft,    TRUE,
  83.         TAG_DONE);
  84.  
  85.         NewGadget . ng_GadgetText    = LocaleString(MSG_SOUNDPANEL_DISCONNECT_GAD);
  86.         NewGadget . ng_GadgetID        = Counter;
  87.  
  88.         GadgetArray[Counter++] = Gadget = CreateGadget(STRING_KIND,Gadget,&NewGadget,
  89.             SZ_Adjust,    TRUE,
  90.             SZ_AutoWidth,    TRUE,
  91.             SZ_LeaveFolder,    TRUE,
  92.  
  93.             GTST_MaxChars,    255,
  94.             GTST_String,    Config -> DisconnectFile,
  95.         TAG_DONE);
  96.  
  97.         NewGadget . ng_GadgetID        = Counter;
  98.  
  99.         GadgetArray[Counter++] = Gadget = CreateGadget(FILE_KIND,Gadget,&NewGadget,
  100.             SZ_Adjust,    TRUE,
  101.             SZ_AutoWidth,    TRUE,
  102.             SZ_PlaceLeft,    TRUE,
  103.         TAG_DONE);
  104.  
  105.         NewGadget . ng_GadgetText    = LocaleString(MSG_SOUNDPANEL_GOOD_TRANSFER_GAD);
  106.         NewGadget . ng_GadgetID        = Counter;
  107.  
  108.         GadgetArray[Counter++] = Gadget = CreateGadget(STRING_KIND,Gadget,&NewGadget,
  109.             SZ_Adjust,    TRUE,
  110.             SZ_AutoWidth,    TRUE,
  111.             SZ_AlignBottom,    TRUE,
  112.             SZ_AlignExtra,    TRUE,
  113.             SZ_LeaveFolder,    TRUE,
  114.  
  115.             GTST_MaxChars,    255,
  116.             GTST_String,    Config -> GoodTransferFile,
  117.         TAG_DONE);
  118.  
  119.         NewGadget . ng_GadgetID        = Counter;
  120.  
  121.         GadgetArray[Counter++] = Gadget = CreateGadget(FILE_KIND,Gadget,&NewGadget,
  122.             SZ_Adjust,    TRUE,
  123.             SZ_AutoWidth,    TRUE,
  124.             SZ_PlaceLeft,    TRUE,
  125.         TAG_DONE);
  126.  
  127.         NewGadget . ng_GadgetText    = LocaleString(MSG_SOUNDPANEL_BAD_TRANSFER_GAD);
  128.         NewGadget . ng_GadgetID        = Counter;
  129.  
  130.         GadgetArray[Counter++] = Gadget = CreateGadget(STRING_KIND,Gadget,&NewGadget,
  131.             SZ_Adjust,    TRUE,
  132.             SZ_AutoWidth,    TRUE,
  133.             SZ_LeaveFolder,    TRUE,
  134.  
  135.             GTST_MaxChars,    255,
  136.             GTST_String,    Config -> BadTransferFile,
  137.         TAG_DONE);
  138.  
  139.         NewGadget . ng_GadgetID        = Counter;
  140.  
  141.         GadgetArray[Counter++] = Gadget = CreateGadget(FILE_KIND,Gadget,&NewGadget,
  142.             SZ_Adjust,    TRUE,
  143.             SZ_AutoWidth,    TRUE,
  144.             SZ_PlaceLeft,    TRUE,
  145.         TAG_DONE);
  146.  
  147.         NewGadget . ng_GadgetText    = LocaleString(MSG_SOUNDPANEL_RING_GAD);
  148.         NewGadget . ng_GadgetID        = Counter;
  149.  
  150.         GadgetArray[Counter++] = Gadget = CreateGadget(STRING_KIND,Gadget,&NewGadget,
  151.             SZ_Adjust,    TRUE,
  152.             SZ_AutoWidth,    TRUE,
  153.             SZ_AlignBottom,    TRUE,
  154.             SZ_AlignExtra,    TRUE,
  155.             SZ_LeaveFolder,    TRUE,
  156.  
  157.             GTST_MaxChars,    255,
  158.             GTST_String,    Config -> RingFile,
  159.         TAG_DONE);
  160.  
  161.         NewGadget . ng_GadgetID        = Counter;
  162.  
  163.         GadgetArray[Counter++] = Gadget = CreateGadget(FILE_KIND,Gadget,&NewGadget,
  164.             SZ_Adjust,    TRUE,
  165.             SZ_AutoWidth,    TRUE,
  166.             SZ_PlaceLeft,    TRUE,
  167.         TAG_DONE);
  168.  
  169.         NewGadget . ng_GadgetText    = LocaleString(MSG_SOUNDPANEL_VOICE_GAD);
  170.         NewGadget . ng_GadgetID        = Counter;
  171.  
  172.         GadgetArray[Counter++] = Gadget = CreateGadget(STRING_KIND,Gadget,&NewGadget,
  173.             SZ_Adjust,    TRUE,
  174.             SZ_AutoWidth,    TRUE,
  175.             SZ_LeaveFolder,    TRUE,
  176.  
  177.             GTST_MaxChars,    255,
  178.             GTST_String,    Config -> VoiceFile,
  179.         TAG_DONE);
  180.  
  181.         NewGadget . ng_GadgetID        = Counter;
  182.  
  183.         GadgetArray[Counter++] = Gadget = CreateGadget(FILE_KIND,Gadget,&NewGadget,
  184.             SZ_Adjust,    TRUE,
  185.             SZ_AutoWidth,    TRUE,
  186.             SZ_PlaceLeft,    TRUE,
  187.         TAG_DONE);
  188.  
  189.         NewGadget . ng_GadgetText    = LocaleString(MSG_SOUNDPANEL_PRELOAD_GAD);
  190.         NewGadget . ng_GadgetID        = Counter;
  191.  
  192.         GadgetArray[Counter++] = Gadget = CreateGadget(CHECKBOX_KIND,Gadget,&NewGadget,
  193.             SZ_Adjust,    TRUE,
  194.             SZ_AutoWidth,    TRUE,
  195.             SZ_AlignBottom,    TRUE,
  196.             SZ_AlignExtra,    TRUE,
  197.             SZ_AlignCentre,    TRUE,
  198.  
  199.             GTCB_Checked,    Config -> Preload,
  200.         TAG_DONE);
  201.  
  202.         SZ_UpdateMaxWidth(BUTTON_KIND,LocaleString(MSG_GLOBAL_USE_GAD),0,NULL);
  203.         SZ_UpdateMaxWidth(BUTTON_KIND,LocaleString(MSG_GLOBAL_CANCEL_GAD),0,NULL);
  204.         SZ_UpdateMaxWidth(BUTTON_KIND,LocaleString(MSG_GLOBAL_LOAD_GAD),0,NULL);
  205.         SZ_UpdateMaxWidth(BUTTON_KIND,LocaleString(MSG_GLOBAL_CANCEL_GAD),0,NULL);
  206.  
  207.         SZ_SetWidth(SZ_ResetMaxWidth());
  208.  
  209.         NewGadget . ng_GadgetText    = LocaleString(MSG_GLOBAL_USE_GAD);
  210.         NewGadget . ng_GadgetID        = Counter;
  211.         NewGadget . ng_Flags        = 0;
  212.  
  213.         GadgetArray[Counter++] = Gadget = CreateGadget(BUTTON_KIND,Gadget,&NewGadget,
  214.             SZ_Adjust,    TRUE,
  215.             SZ_AutoWidth,    TRUE,
  216.             SZ_AlignExtra,    TRUE,
  217.             SZ_AlignBottom,    TRUE,
  218.             SZ_GroupCount,    4,
  219.         TAG_DONE);
  220.  
  221.         NewGadget . ng_GadgetText    = LocaleString(MSG_GLOBAL_LOAD_GAD);
  222.         NewGadget . ng_GadgetID        = Counter;
  223.  
  224.         GadgetArray[Counter++] = Gadget = CreateGadget(BUTTON_KIND,Gadget,&NewGadget,
  225.             SZ_Adjust,    TRUE,
  226.             SZ_AutoWidth,    TRUE,
  227.             SZ_GroupNext,    TRUE,
  228.         TAG_DONE);
  229.  
  230.         NewGadget . ng_GadgetText    = LocaleString(MSG_GLOBAL_SAVE_GAD);
  231.         NewGadget . ng_GadgetID        = Counter;
  232.  
  233.         GadgetArray[Counter++] = Gadget = CreateGadget(BUTTON_KIND,Gadget,&NewGadget,
  234.             SZ_Adjust,    TRUE,
  235.             SZ_AutoWidth,    TRUE,
  236.             SZ_GroupNext,    TRUE,
  237.         TAG_DONE);
  238.  
  239.         NewGadget . ng_GadgetText    = LocaleString(MSG_GLOBAL_CANCEL_GAD);
  240.         NewGadget . ng_GadgetID        = Counter;
  241.  
  242.         GadgetArray[Counter] = Gadget = CreateGadget(BUTTON_KIND,Gadget,&NewGadget,
  243.             SZ_Adjust,    TRUE,
  244.             SZ_AutoWidth,    TRUE,
  245.             SZ_GroupNext,    TRUE,
  246.         TAG_DONE);
  247.     }
  248.  
  249.     return(Gadget);
  250. }
  251.  
  252. BYTE
  253. SoundPanel(struct SoundConfig *Config)
  254. {
  255.     STATIC struct Gadget    *GadgetArray[GAD_CANCEL + 1];
  256.     struct Gadget        *GadgetList = NULL;
  257.     struct Window        *PanelWindow;
  258.  
  259.     STATIC struct SoundConfig BackupConfig;
  260.  
  261.     CopyMem(Config,&BackupConfig,sizeof(struct SoundConfig));
  262.  
  263.     if(CreateAllGadgets(Config,GadgetArray,&GadgetList))
  264.     {
  265.         if(PanelWindow = OpenWindowTags(NULL,
  266.             WA_Left,    GetScreenLeft(Window) + (GetScreenWidth(Window) - SZ_GetWindowWidth()) / 2,
  267.             WA_Top,        GetScreenTop(Window) + (GetScreenHeight(Window) - SZ_GetWindowHeight())    / 2,
  268.             WA_Width,    SZ_GetWindowWidth(),
  269.             WA_Height,    SZ_GetWindowHeight(),
  270.  
  271.             WA_Activate,    TRUE,
  272.             WA_DragBar,    TRUE,
  273.             WA_DepthGadget,    TRUE,
  274.             WA_RMBTrap,    TRUE,
  275.             WA_DepthGadget,    TRUE,
  276.             WA_CloseGadget,    TRUE,
  277.             WA_CustomScreen,Window -> WScreen,
  278.  
  279.             WA_IDCMP,    IDCMP_GADGETDOWN | IDCMP_ACTIVEWINDOW | IDCMP_CLOSEWINDOW | IDCMP_RAWKEY | IDCMP_VANILLAKEY | BUTTONIDCMP | CHECKBOXIDCMP | STRINGIDCMP,
  280.  
  281.             WA_Title,    LocaleString(MSG_SOUNDPANEL_SOUND_PREFERENCES_TXT),
  282.         TAG_DONE))
  283.         {
  284.             struct IntuiMessage    *Massage;
  285.             ULONG             IClass,Code;
  286.             struct Gadget        *Gadget;
  287.             BYTE             Terminated = FALSE;
  288.             STRPTR             DummyChar;
  289.             UBYTE             DummyBuffer[MAX_FILENAME_LENGTH];
  290.             struct FileRequester    *FileRequest;
  291.  
  292.             GuideContext(CONTEXT_SOUND);
  293.  
  294.             PushWindow(PanelWindow);
  295.  
  296.             AddGList(PanelWindow,GadgetList,(UWORD)-1,(UWORD)-1,NULL);
  297.             RefreshGList(GadgetList,PanelWindow,NULL,(UWORD)-1);
  298.             GT_RefreshWindow(PanelWindow,NULL);
  299.  
  300.             ActiveGadget = NULL;
  301.  
  302.             ClrSignal(SIG_BREAK);
  303.  
  304.             while(!Terminated)
  305.             {
  306.                 if(Wait(PORTMASK(PanelWindow -> UserPort) | SIG_BREAK) & SIG_BREAK)
  307.                     break;
  308.  
  309.                 while(!Terminated && (Massage = (struct IntuiMessage *)GT_GetIMsg(PanelWindow -> UserPort)))
  310.                 {
  311.                     IClass    = Massage -> Class;
  312.                     Code    = Massage -> Code;
  313.                     Gadget    = (struct Gadget *)Massage -> IAddress;
  314.  
  315.                     GT_ReplyIMsg(Massage);
  316.  
  317.                     KeySelect(GadgetArray,GAD_CANCEL,Code,PanelWindow,&Gadget,&IClass,&Code);
  318.  
  319.                     if(IClass == IDCMP_ACTIVEWINDOW && ActiveGadget)
  320.                         ActivateGadget(ActiveGadget,PanelWindow,NULL);
  321.  
  322.                     if(IClass == IDCMP_GADGETDOWN)
  323.                     {
  324.                         if((Gadget -> GadgetType & GTYP_GTYPEMASK) == GTYP_STRGADGET)
  325.                             ActiveGadget = Gadget;
  326.                     }
  327.  
  328.                     if(IClass == IDCMP_CLOSEWINDOW)
  329.                         Terminated = TRUE;
  330.  
  331.                     if(IClass == IDCMP_GADGETUP)
  332.                     {
  333.                         switch(Gadget -> GadgetID)
  334.                         {
  335.                             case GAD_USE:
  336.  
  337.                                 Terminated = TRUE;
  338.  
  339.                                 memset(Config,0,sizeof(struct SoundConfig));
  340.  
  341.                                 strcpy(Config -> BellFile,        SZ_GetString(GadgetArray[GAD_BELL]));
  342.  
  343.                                 strcpy(Config -> ConnectFile,        SZ_GetString(GadgetArray[GAD_CONNECT]));
  344.                                 strcpy(Config -> DisconnectFile,    SZ_GetString(GadgetArray[GAD_DISCONNECT]));
  345.  
  346.                                 strcpy(Config -> GoodTransferFile,    SZ_GetString(GadgetArray[GAD_GOOD_TRANSFER]));
  347.                                 strcpy(Config -> BadTransferFile,    SZ_GetString(GadgetArray[GAD_BAD_TRANSFER]));
  348.  
  349.                                 strcpy(Config -> RingFile,        SZ_GetString(GadgetArray[GAD_RING]));
  350.                                 strcpy(Config -> VoiceFile,        SZ_GetString(GadgetArray[GAD_VOICE]));
  351.  
  352.                                 Config -> Preload = SZ_GetChecked(GadgetArray[GAD_PRELOAD]);
  353.  
  354.                                 SoundChanged = memcmp(&BackupConfig,Config,sizeof(struct SoundConfig));
  355.  
  356.                                 break;
  357.  
  358.                             case GAD_CANCEL:
  359.  
  360.                                 Terminated = TRUE;
  361.  
  362.                                 break;
  363.  
  364.                             case GAD_LOAD:
  365.  
  366.                                 strcpy(DummyBuffer,LastSound);
  367.  
  368.                                 DummyChar = PathPart(DummyBuffer);
  369.  
  370.                                 *DummyChar = 0;
  371.  
  372.                                 BlockWindow(PanelWindow);
  373.  
  374.                                 if(FileRequest = GetFile(LocaleString(MSG_SOUNDPANEL_LOAD_SOUNDS_TXT),DummyBuffer,FilePart(LastSound),DummyBuffer,"#?.prefs",FALSE,FALSE,FALSE,LocaleString(MSG_GLOBAL_LOAD_TXT),TRUE))
  375.                                 {
  376.                                     if(!ReadIFFData(DummyBuffer,Config,sizeof(struct SoundConfig),ID_SOUN))
  377.                                         MyEasyRequest(Window,LocaleString(MSG_SOUNDPANEL_COULD_NOT_LOAD_SOUNDS_TXT),LocaleString(MSG_GLOBAL_CONTINUE_TXT),DummyBuffer);
  378.                                     else
  379.                                     {
  380.                                         SoundChanged = FALSE;
  381.  
  382.                                         strcpy(LastSound,DummyBuffer);
  383.  
  384.                                         GT_SetGadgetAttrs(GadgetArray[GAD_BELL],PanelWindow,NULL,
  385.                                             GTST_String,Config -> BellFile,
  386.                                         TAG_DONE);
  387.  
  388.                                         GT_SetGadgetAttrs(GadgetArray[GAD_CONNECT],PanelWindow,NULL,
  389.                                             GTST_String,Config -> ConnectFile,
  390.                                         TAG_DONE);
  391.  
  392.                                         GT_SetGadgetAttrs(GadgetArray[GAD_DISCONNECT],PanelWindow,NULL,
  393.                                             GTST_String,Config -> DisconnectFile,
  394.                                         TAG_DONE);
  395.  
  396.                                         GT_SetGadgetAttrs(GadgetArray[GAD_GOOD_TRANSFER],PanelWindow,NULL,
  397.                                             GTST_String,Config -> GoodTransferFile,
  398.                                         TAG_DONE);
  399.  
  400.                                         GT_SetGadgetAttrs(GadgetArray[GAD_BAD_TRANSFER],PanelWindow,NULL,
  401.                                             GTST_String,Config -> BadTransferFile,
  402.                                         TAG_DONE);
  403.  
  404.                                         GT_SetGadgetAttrs(GadgetArray[GAD_RING],PanelWindow,NULL,
  405.                                             GTST_String,Config -> RingFile,
  406.                                         TAG_DONE);
  407.  
  408.                                         GT_SetGadgetAttrs(GadgetArray[GAD_VOICE],PanelWindow,NULL,
  409.                                             GTST_String,Config -> VoiceFile,
  410.                                         TAG_DONE);
  411.  
  412.                                         GT_SetGadgetAttrs(GadgetArray[GAD_PRELOAD],PanelWindow,NULL,
  413.                                             GTCB_Checked,Config -> Preload,
  414.                                         TAG_DONE);
  415.                                     }
  416.  
  417.                                     FreeAslRequest(FileRequest);
  418.                                 }
  419.  
  420.                                 ReleaseWindow(PanelWindow);
  421.  
  422.                                 break;
  423.  
  424.                             case GAD_SAVE:
  425.  
  426.                                 strcpy(DummyBuffer,LastSound);
  427.  
  428.                                 DummyChar = PathPart(DummyBuffer);
  429.  
  430.                                 *DummyChar = 0;
  431.  
  432.                                 BlockWindow(PanelWindow);
  433.  
  434.                                 if(FileRequest = GetFile(LocaleString(MSG_SOUNDPANEL_SAVE_SOUNDS_TXT),DummyBuffer,FilePart(LastSound),DummyBuffer,"#?.prefs",TRUE,FALSE,FALSE,LocaleString(MSG_GLOBAL_SAVE_TXT),TRUE))
  435.                                 {
  436.                                     STATIC struct SoundConfig DummyConfig;
  437.  
  438.                                     memset(&DummyConfig,0,sizeof(struct SoundConfig));
  439.  
  440.                                     strcpy(DummyConfig . BellFile,        SZ_GetString(GadgetArray[GAD_BELL]));
  441.  
  442.                                     strcpy(DummyConfig . ConnectFile,    SZ_GetString(GadgetArray[GAD_CONNECT]));
  443.                                     strcpy(DummyConfig . DisconnectFile,    SZ_GetString(GadgetArray[GAD_DISCONNECT]));
  444.  
  445.                                     strcpy(DummyConfig . GoodTransferFile,    SZ_GetString(GadgetArray[GAD_GOOD_TRANSFER]));
  446.                                     strcpy(DummyConfig . BadTransferFile,    SZ_GetString(GadgetArray[GAD_BAD_TRANSFER]));
  447.  
  448.                                     strcpy(DummyConfig . RingFile,        SZ_GetString(GadgetArray[GAD_RING]));
  449.                                     strcpy(DummyConfig . VoiceFile,        SZ_GetString(GadgetArray[GAD_VOICE]));
  450.  
  451.                                     DummyConfig . Preload = SZ_GetChecked(GadgetArray[GAD_PRELOAD]);
  452.  
  453.                                     if(!WriteIFFData(DummyBuffer,&DummyConfig,sizeof(struct SoundConfig),ID_SOUN))
  454.                                         MyEasyRequest(Window,LocaleString(MSG_SOUNDPANEL_COULD_NOT_SAVE_SOUNDS_TXT),LocaleString(MSG_GLOBAL_CONTINUE_TXT),DummyBuffer);
  455.                                     else
  456.                                     {
  457.                                         strcpy(LastSound,DummyBuffer);
  458.  
  459.                                         SoundChanged = FALSE;
  460.                                     }
  461.  
  462.                                     FreeAslRequest(FileRequest);
  463.                                 }
  464.  
  465.                                 ReleaseWindow(PanelWindow);
  466.  
  467.                                 break;
  468.  
  469.                             case GAD_PRELOAD:
  470.  
  471.                                 break;
  472.  
  473.                             default:
  474.  
  475.                                 if((Gadget -> GadgetType & GTYP_GTYPEMASK) == GTYP_STRGADGET)
  476.                                 {
  477.                                     if(Code != '\t')
  478.                                     {
  479.                                         STRPTR Name = SZ_GetString(Gadget);
  480.  
  481.                                         if(Name[0])
  482.                                         {
  483.                                             struct SoundInfo *SoundInfo;
  484.  
  485.                                             BlockWindow(PanelWindow);
  486.     
  487.                                             if(SoundInfo = LoadSound(Name,FALSE))
  488.                                             {
  489.                                                 PlaySound(SoundInfo);
  490.  
  491.                                                 FreeSound(SoundInfo);
  492.                                             }
  493.  
  494.                                             ReleaseWindow(PanelWindow);
  495.                                         }
  496.                                     }
  497.                                 }
  498.                                 else
  499.                                 {
  500.                                     LONG Selection = Gadget -> GadgetID - 1;
  501.  
  502.                                     BlockWindow(PanelWindow);
  503.  
  504.                                     strcpy(SharedBuffer,SZ_GetString(GadgetArray[Selection]));
  505.  
  506.                                     if(FilePart(SharedBuffer) == SharedBuffer)
  507.                                         SharedBuffer[0] = 0;
  508.                                     else
  509.                                     {
  510.                                         DummyChar = PathPart(SharedBuffer);
  511.  
  512.                                         *DummyChar = 0;
  513.                                     }
  514.  
  515.                                     DummyChar = FilePart(SZ_GetString(GadgetArray[Selection]));
  516.  
  517.                                     if(FileRequest = GetFile(LocaleString(MSG_SOUNDPANEL_SELECT_BELL_TXT + (Selection / 2)),SharedBuffer,DummyChar,SharedBuffer,NULL,FALSE,FALSE,FALSE,LocaleString(MSG_GLOBAL_SELECT_TXT),TRUE))
  518.                                     {
  519.                                         GT_SetGadgetAttrs(GadgetArray[Selection],PanelWindow,NULL,
  520.                                             GTST_String,SharedBuffer,
  521.                                         TAG_DONE);
  522.  
  523.                                         FreeAslRequest(FileRequest);
  524.                                     }
  525.  
  526.                                     ReleaseWindow(PanelWindow);
  527.                                 }
  528.  
  529.                                 break;
  530.                         }
  531.                     }
  532.                 }
  533.             }
  534.  
  535.             RemoveGList(PanelWindow,GadgetList,(UWORD)-1);
  536.  
  537.             PopWindow();
  538.  
  539.             CloseWindow(PanelWindow);
  540.         }
  541.     }
  542.  
  543.     FreeGadgets(GadgetList);
  544.  
  545.     return((BYTE)memcmp(&BackupConfig,Config,sizeof(struct SoundConfig)));
  546. }
  547.